package com.wn55.hrms.mapper;

import com.wn55.hrms.entity.Employee;
import com.wn55.hrms.service.vo.AgeVo;
import com.wn55.hrms.service.vo.DeptNumVo;
import com.wn55.hrms.service.vo.EmployeeVo;
import com.wn55.hrms.service.vo.JobStatusVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface EmployeeMapper {
    int deleteByPrimaryKey(Long id);

    int insert(Employee record);

    Employee selectByPrimaryKey(Long id);

    List<Employee> selectAll();

    int updateByPrimaryKey(Employee record);

    List<Employee> listByCondition(String name);

    @Select("select * from employee where emp_name = #{name }")
    Employee selectManagerByName(String name);

    List<EmployeeVo> listManagerByCondition(@Param("name") String name,@Param("empType") Integer empType,@Param("pId") Integer pId);

    @Update("update employee set emp_code=#{empCode},emp_name=#{empName},emp_password=#{empPassword},avatar=#{avatar},personal_phone=#{personalPhone},personal_email=#{personalEmail},update_time=#{updateTime} where id=#{id}")
    void updateManager(EmployeeVo employeeVo);

    @Delete("delete from employee_role where employee_id=#{id}")
    void deleteRoleByEmpId(Long id);

    void insertRoleById(@Param("list") List<Integer> list, @Param("id") Long id);

    @Update("update employee set locked=#{locked} where id=#{eId}")
    void lockedManager(@Param("eId") Integer eId, @Param("locked") Integer locked);

    List<EmployeeVo> listInternByCondition(@Param("name")String name, @Param("deptId")Integer deptId,@Param("pId") Integer pId);

    AgeVo initAgeData();

    JobStatusVo initJobStatusData();

    DeptNumVo initDeptData();

    List<EmployeeVo> initImgData();

    List<EmployeeVo> listEmpByCondition(@Param("deptId") Integer deptId,@Param("positionId") Integer positionId);
}